#!/bin/bash
export JAVA_HOME=/home/xplay/jdk1.8
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
JAVA_MEM_OPTS="-server -Dspring.profiles.active=prod -Dname=Xpocker -DREDIS_PASSWORD=你的密码 -DMYSQL_PASSWORD=你的密码 -DMYSQL_USER=你的用户"
start(){
	nohup java $JAVA_MEM_OPTS -jar  Xpocker.jar > /dev/null 2>&1 &
}
stop(){
	ps -ef |grep Xpocker.jar |grep -v grep|awk '{print $2}'|xargs kill -9
}

if [ "$#" -ne 1 ]; then
    echo "Usage: $0 {start|stop}"
    exit 1
fi
 
# 根据参数执行不同的命令
case "$1" in
    start)
        echo "Starting service..."
        stop
        start
        ;;
    stop)
        echo "Stopping service..."
        stop
        ;;
    *)
        echo "Unknown argument: $1"
        exit 1
        ;;
esac

exit 0
